How to assign array values to the n-1 location in the array